package com.zhao.oss.controller;

import com.zhao.Result;
import com.zhao.oss.seivice.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/eduoss")
@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;
    @PostMapping("/uploadAvatar")
    public Result uploadAvatar(MultipartFile file){
        String uploadUrl = ossService.upload(file);
        return Result.ok().data("url",uploadUrl);
    }


}
